#include <iostream>
#include <vector>


using std::vector;
using std::cin;
using std::cout;

enum color { WHITE, GREY, BLACK };

class AbstractDoer {
public:
    virtual void entering(int vertex) {};
    virtual void leaving(int vertex) {};
    virtual void grey_edge(int from, int to) {}
    virtual void black_edge(int from, int to) {}
    virtual void before_iteration(int from, int to) {}
    virtual void after_iteration(int from, int to) {}
};


void dfs(const vector<vector<int>>& graph, vector <color>& was, AbstractDoer* Doer, int vertex) {
    was[vertex] = GREY;
    Doer->entering(vertex);
    for (auto next_vertex : graph[vertex]) {
        if (was[next_vertex] == GREY)
            Doer->grey_edge(vertex, next_vertex);
        else if (was[next_vertex] == BLACK) {
            Doer->black_edge(vertex, next_vertex);
        }
        else {
            Doer->before_iteration(vertex, next_vertex);
            dfs(graph, was, Doer, next_vertex);
            Doer->after_iteration(vertex, next_vertex);
        }
    }
    was[vertex] = BLACK;
    Doer->leaving(vertex);
}


class Printer : public AbstractDoer {
public:
    void entering(int vertex) {
        cout << "Entered vertex " << vertex << ". \n";
    } 
    void leaving(int vertex) {
        cout << "Left vertex " << vertex << ". \n";
    }
};

class BridgesFinder : public AbstractDoer {
public:
    int timer;
    vector<int> tin, fup;
    BridgesFinder(int n):timer(0) {
        tin.resize(n, 0);
        fup.resize(n, 0);
    }

    void entering(int vertex) {
        tin[vertex] = fup[vertex] = timer++;
    } 
    
    void grey_edge(int from, int to) {
        fup[from] = std::min(fup[from], tin[to]);
    }
    
    void black_edge(int from, int to) {
        fup[from] = std::min(fup[from], tin[to]);
    }

    void after_iteration(int from, int to) {
        fup[from] = std::min(fup[from], fup[to]);
        if (fup[to] > tin[from])
            cout << "Bridge: " << from + 1 << " " << to + 1 << std::endl;
    }
};


int main() {
    int n, m;
    cin >> n >> m;
    vector <vector<int>> edges;
    edges.resize(n);
    vector <color> was(n);
    for (int i = 0; i < m; ++i) {
        int l, r; cin >> l >> r;
        --l; --r;
        edges[l].push_back(r);
        edges[r].push_back(l);
    }
    auto doer = new BridgesFinder(n);
    dfs(edges, was, doer, 1);
}